<div class="content-page" style="min-height: 500px;">
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
    <page-title icon="&#9991;" title="Message History"></page-title>



  <section class="row-fluid">
    <div class="span12">
        <a style="float: right" target="_blank" href="http://apigee.com/docs/usergrid/content/push-notifications" class="notifications-links">Learn more in our docs</a>

        <div class="pull-left" style="margin-top: 10px;">
          <ul class="nav nav-pills">
            <li ng-class="selectedHistory.name === option.name ? 'active' : ''" ng-repeat="option in historyList"><a ng-click="showHistory(option)">{{option.name}}</a></li>
          </ul>
        </div>
     </div>
    </section>
  <section class="row-fluid">
    <div class="span12">
      <div ng-if="notificationCollection._list.length === 0">
        No messages found
      </div>

      <div ng-repeat="notification in notificationCollection._list">
        <div style="border: 1px solid #aaa;">
            <div class="notifications-header">
              <div style="float: left">
                <strong>Send Date:</strong>
                {{getNotificationStartedDate(notification._data) | date:'EEEE, MMMM d, y h:mm:ss a'}}
                <div style="margin-top: 10px;">
                  <img ng-src="{{getStateImage(notification)}}" style="vertical-align:middle;margin-top: -3px;"> {{getStateMessage(notification)}}
                </div>
              </div>
              <div style="float: right; text-align: right;" title="you must send debug=true in message">
                &nbsp; <a href="" class="notifications-links" ng-click="viewReceipts(notification._data.uuid)">view details</a>
                <br>Total Expected: {{notification._data.expectedCount}}, Total Sent: {{notification._data.statistics.sent ? notification._data.statistics.sent : 0}}, Total Errors: {{notification._data.statistics.errors ? notification._data.statistics.errors : 0}}
                <br>
                <b>UUID</b>:
                <a href="" ng-click="viewReceipts('{{notification._data.uuid}}')">{{notification._data.uuid}}</a>
              </div>
            </div>
            <div style="padding: 10px;">
             <div> payload: {{notification._data.payloads}} </div>
             <div ng-if="notification._data.errorMessage"> error message: {{notification._data.errorMessage}} </div>
            </div>
          </div>
          <br>
        </div>

        <div style="height:20px">&nbsp;</div>
        <div style="padding: 10px 5px 10px 5px">
          <button class="btn btn-primary" ng-click="getPrevious()" style="display:{{previous_display}}">< Previous</button>
          <button class="btn btn-primary" ng-click="getNext()" style="display:{{next_display}}; float:right;">Next ></button>
        </div>
      </div>
   </section>
</div>
